#pragma once

template <typename T>
class Singleton
{
private:
  static T *_singleton;
protected:
  Singleton () { }
  ~Singleton () { }
public:
  static T *getInstance ()
  {
    if (NULL == _singleton)
        _singleton = new T;
    return (static_cast<T*> (_singleton));
  }
  static void kill ()
  {
    if (NULL != _singleton)
      {
        delete _singleton;
        _singleton = NULL;
      }
  }
};
template <typename T>
T *Singleton<T>::_singleton = NULL;